﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Master.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="UI.Admin.User.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    	<link rel="stylesheet" href="/Admin/assets/css/jquery-ui-1.10.3.full.min.css" />
    <script src="JsFunction.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="row">
	    <div class="col-xs-12">
           
		    <h3 class="header smaller lighter green">用户列表&nbsp;&nbsp;&nbsp;&nbsp;<a class="btn btn-success btn-sm" onclick="summit_add_user()"><i class="icon-plus"></i>添加用户</a></h3>
		    <div class="table-header badge-success">
			    系统管理员可以为系统添加不同的用户，并配以不同的角色。
		    </div>

		    <div class="table-responsive">
			    <table id="sample-table-2" class="table table-striped table-bordered table-hover">
				    <thead>
					    <tr>
						    <th class="center">
							    <label>
                                    
								    <input type="checkbox" class="ace" />
								    <span class="lbl"></span>
							    </label>
						    </th>
						    <th>ID</th>
                             <th>用户名</th>				
						    <th>用户状态</th>
						    <th>用户角色</th>
						    <th>上级用户</th>                        
						    <th></th>
					    </tr>
				    </thead>

				    <tbody>

                     <%if(userList!=null){ %>
                        <%for(int i=0;i<userList.Count;i++){ %>
					    <tr>
						    <td class="center">
							    <label>
								    <input type="checkbox" class="ace" />
								    <span class="lbl"></span>
							    </label>
						    </td>

						    <td><%=userList[i].ID %></td>
						    <td><%=userList[i].Name %></td>
						    <td><span class="label label-success arrowed"><i class='icon-<%=userList[i].UserEnabled?"ok":"remove" %>'></i></span></td>
						    <td><%=roleNameToID[userList[i].RoleID.ToString()] %></td>
						    <td><%=userNameToID[userList[i].ParentID.ToString()] %></td>
						    <td>
							    <div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
							

								    <a class="green" href="javascript:void(0)" onclick="summit_update_user('<%=userList[i].ID %>','<%=userList[i].Name %>','<%=userList[i].RoleID %>','<%=userList[i].UserEnabled %>')">
									    <i class="icon-pencil bigger-130"></i>
								    </a>

								    <a class="red" href="javascript:void(0)" onclick="summit_delete_user('<%=userList[i].ID %>')">
									    <i class="icon-trash bigger-130"></i>
								    </a>
							    </div>
						    </td>
					    </tr>
	                    <%} %>
                    <%} %>
				    </tbody>
			    </table>
		    </div>
	    </div>
    </div>
    	<div id="dialog-message" class="hide">	
    <!-- 返回操作的用户以及IP地址 -->
    <input type="hidden" id="UserName" value="UserName" />
    <input type="hidden" id="UserIP" value="1314>" />	
		    <label>用户名称：</label>
		    <input type="text" placeholder="登录名" id="Name"/>
            <br /><br />
		     <label>用户密码：</label>
		    <input type="password" placeholder="登录密码" id="Password"/>
            <br /><br />
		     <label>确认密码：</label>
		    <input type="password" placeholder="重输密码" id="RePassword"/>
             <br /><br />
		     <label>角色选择：</label>
		    <select  id="form-field-select-1">
                <option value="">&nbsp;</option>
                <%if(roleList!=null){ %>
                <%for(int i=0;i<roleList.Count;i++){ %>
				<option value="<%=roleList[i].ID %>"><%=roleList[i].Name %></option>				
                 <%} %>	
                <%} %>												
			</select>
           <br /><br />
          <label>用户状态：</label>		
			<input name="switch-field-1" class="ace ace-switch ace-switch-7" type="checkbox" checked=""/>
			<span class="lbl"></span>
				
				
	</div><!-- #dialog-message -->

    <div id="dialog-confirm" class="hide">
		<div class="alert alert-info bigger-110">
			删除操作执行后不可恢复
		</div>

		<div class="space-6"></div>

		<p class="bigger-110 bolder center grey">
			<i class="icon-hand-right blue bigger-120"></i>
			Are you sure?
		</p>
	</div><!-- #dialog-confirm -->


</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="server">
    <script src="/Admin/assets/js/jquery.dataTables.min.js" charset="GB2312"></script>
	<script src="/Admin/assets/js/jquery.dataTables.bootstrap.js" charset="GB2312"></script>
    <script src="/Admin/assets/js/jquery-ui-1.10.3.full.min.js"></script>
	<script src="/Admin/assets/js/jquery.ui.touch-punch.min.js"></script>

    <script type="text/javascript">
        jQuery(function ($) {
            var oTable1 = $('#sample-table-2').dataTable({
                "aoColumns": [
			      { "bSortable": false },
			      null, null, null, null, null,
				  { "bSortable": false }
                ]
            });


            $('table th input:checkbox').on('click', function () {
                var that = this;
                $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function () {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

            });


            $('[data-rel="tooltip"]').tooltip({ placement: tooltip_placement });
            function tooltip_placement(context, source) {
                var $source = $(source);
                var $parent = $source.closest('table')
                var off1 = $parent.offset();
                var w1 = $parent.width();

                var off2 = $source.offset();
                var w2 = $source.width();

                if (parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2)) return 'right';
                return 'left';
            }
        })

        $.widget("ui.dialog", $.extend({}, $.ui.dialog.prototype, {
            _title: function (title) {
                var $title = this.options.title || '&nbsp;'
                if (("title_html" in this.options) && this.options.title_html == true)
                    title.html($title);
                else title.text($title);
            }
        }));
		</script>
</asp:Content>
